home *** CD-ROM | disk | FTP | other *** search
- XYPLOT.PAS is a program to plot any arbitrary curve on a
- monochrome monitor. The program asks the user for a lower and
- upper bpund of X, evaluates the function 540 times to determine
- the range of Y, and the evaluates the function 540 times again and
- plots the function in a graphic window. The program automatically
- scales so that the usefull part of the screen is completely
- filled, except for a small margin at the top and bottom. Once the
- curve is displayed you can evaluate the function for any point
- included in the display.
-
- One use would be to diminish the X bounds, and run the program
- again, thus 'zooming in'. You can very quickly find the roots of
- an equation by a few runs of the program.
-
- The program works with both continuous functions, where you supply
- the function, or with arrays. The program automatically
- interpolates within an array based on the two samples adjacent to
- the value of X wanted by the plot routine. In some applications,
- a smoothing function might be inserted between the program and the
- array. Thus, GofX would be a smoothing function which did the
- actual call to get array values.
-
- Since Files are simply conceptual extensions of arrays; you could
- either read a text FILE into an array, or read the file once to
- determine the range of Y and a second time to do the actual plot.
-
- As provided here, the plotter is embedded in a demonstration
- program so you can experiment with it a bit. Four sample functions
- and one sample array are provided. If you decide you can use it,
- extract the procedure XYPLOT and import it into your own program.
- That program must be a GEM based program. That is, it starts out:
- IF Init_Gem THEN ..... . Don't be put off by the size of the
- program, most of the size originates in the demonstration, not in
- the plot procedure per se. A lot of the size is caused by dialog
- boxes you will never see unless you make faulty entries of various
- kinds.
-
- The approach seems kind of 'backwards' because the main program,
- the GofX you provide, is buried in a function. But nowhere is it
- written that a function has to be 'smallish'. So GofX might well
- be several thousand bytes long.
-
- The program includes a string to number convertor that might be
- usefull in its own right, too. The rules followed are liberalized
- rules so it will accept any valid integer, long_integer or real.
- The liberalization relaxes the Pascal rules for decimal points in
- real numbers. There is extensive use of recursion in the
- convertor which might be of some value as a tutorial. You can
- specify the numeric result as being either integer, long_integer,
- or real.
-
- I would consider requests to enhance the program. I think it
- demonstrates nicely the potential for the ST in doing serious
- work. The notion of a built in XY plotter was a strong part of
- the attraction of the ST when I bought mine. This has a lot of
- appeal when you have, as I have, spent written many programs that
- write crude 'X's on printers trying to convey the notion of a
- smooth curve!
-
- Since I don't have a color monitor, I didn't provide for it. It
- shouldn't be too hard to modify the program to accomodate it.
- Just do a search for the numbers 640 and 540 and that should lead
- you to all of the monochrome unique code. (540 because 100 pixels
- are reserved for the text on the left side of the display.)
-
- Merlin Hanson
- Genie: M.L.HANSON
-